package com.addplus.townmall.server.api.mapper.town;

import com.addplus.townmall.server.api.model.town.OrderInvoice;
import com.addplus.townmall.server.api.utils.BaseAddMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 商城订单发票内容 Mapper 接口
 * </p>
 *
 * @author zhangjiehang
 * @since 2018-09-25
 */
public interface OrderInvoiceMapper extends BaseAddMapper<OrderInvoice> {

    @Select("SELECT\n" +
            " id,\n" +
            " order_id,\n" +
            " invoice_type,\n" +
            " invoice_title_type,\n" +
            " invoice_title,\n" +
            " invoice_code,\n" +
            " invoice_context,\n" +
            " invoice_amount,\n" +
            " invoice_remark,\n" +
            " buyer_address_and_phone,\n" +
            " buyer_bank_name_and_account\n" +
            "FROM\n" +
            " order_invoice \n" +
            "WHERE\n" +
            " order_id = #{orderId} \n" +
            " AND is_delete = 0 AND type = 1")
    OrderInvoice getOrderInvoiceByOrderId(@Param("orderId") Integer orderId);

}
